package com.ostrich.module_more

import androidx.lifecycle.LiveData
import com.ostrich.library_base.BaseRepository
import com.ostrich.library_net.BaseResponse
import com.ostrich.library_net.RetrofitManager
import com.ostrich.module_more.themes.entity.ThemesDataEntity
import com.ostrich.module_more.themes.entity.ThemesTabEntity
import io.reactivex.Observable
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.http.Path

/**
 * @Author : yaotianxue
 * @Time : On 2023/11/1 11:01
 * @Description : MoreRepository
 */
class MoreRepository:BaseRepository() {
    //rxjava
    private val rxMoreApi:MoreApi by lazy {
        RetrofitManager.instance.createRxService(MoreApi::class.java)
    }
    //livedata
    private val moreApi:MoreApi by lazy {
        RetrofitManager.instance.createService(MoreApi::class.java)
    }
    //tab选项卡
    fun tabList(): Observable<ThemesTabEntity>{
        return rxMoreApi.tabList()
    }
    //tab数据
    fun data( id:Int): LiveData<BaseResponse<MutableList<ThemesDataEntity>>>{
        //后台接口有问题需要手动处理下
        if(id == -1){
            return moreApi.data(0)
        }
        return moreApi.data(id)

    }
}